package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {
    private Controller mController;

    @Override
    public void start(Stage primaryStage) throws Exception{
//        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));

        FXMLLoader fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(getClass().getResource("sample.fxml"));
        Parent root = fxmlLoader.load();
        primaryStage.setTitle("顶棚导向设备测试工具");
        primaryStage.setScene(new Scene(root));
        primaryStage.show();
        mController = fxmlLoader.getController();
        mController.init();
    }

    @Override
    public void stop() throws Exception {
        super.stop();
        if (null != mController){
            mController.closePort();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}
